<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <meta http-equiv='X-UA-Compatible' content='ie=edge'>
    <title>Document</title>
</head>

<body>
    <div id='app'>
        <coma :res="boo">
            <!-- 作用域插槽,通过父组件来操作子组件的显示方式 -->
            <template v-slot="scoped">
                <!-- {{scoped}}是一个对象,接收过来插槽传递的数据,做了一层对象的包裹  -->
                <!-- <p>{{scoped.row}}</p> -->
                <img v-if="scoped.row==true" src="vip.jfif" alt="" width=100>
                <img v-else src="fvip.jfif" alt="" width=100>
            </template>
        </coma>
    </div>
    <script src='https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js'></script>
    <script>
        Vue.component('coma', {
            props: ['res'],
            template:
                `<div>欢迎您: <slot :row="res"></slot> </div>`
        });



        const vm = new Vue({
            el: '#app',
            data: {
                boo: false
            },
            methods: {},
        })
    </script>
</body>

</html>